from django.test import TestCase

# Create your tests here.
import tushare as ts
from django.conf import settings
import pymysql, sqlalchemy
from stock import global_variable as gv, models

# df = tspro.index_basic(market='SZSE')#上交SSE，深交SZSE
# df = gv.tspro.index_daily(ts_code='000001.SH', start_date='20200101', end_date='20201010')
# print(df)
# df.to_sql('index_daily', engine, index=True, index_label='id', if_exists='append')//由于sqlite不带自增所以这么写
# df.to_sql('index_daily', gv.DB_engine, index=False, if_exists='append')#mysql带自增id字段，不用index指定id列了

from django.apps import apps

modelobj = apps.get_model('stock', 'index_daily')

fielddic = {}

for field in modelobj._meta.fields:
    fielddic[field.name] = field.verbose_name

print(fielddic)
